package com.ymttest.business.service.productdata.impl;

import com.ymttest.business.service.productdata.ActivityOperate;
import com.ymttest.business.service.productdata.LiveOperate;
import com.ymttest.business.service.productdata.ProductOpreate;
import com.ymttest.business.service.productdata.bean.ApplyProductBean;
import com.ymttest.business.service.productdata.bean.ProductBean;

public abstract class AbstractProductService implements ProductOpreate {
	private LiveOperate live;
	private ActivityOperate activity;

	public LiveOperate getLive() {
		return live;
	}

	public void setLive(LiveOperate live) {
		this.live = live;
	}

	public ActivityOperate getActivity() {
		return activity;
	}

	public void setActivity(ActivityOperate activity) {
		this.activity = activity;
	}

	public AbstractProductService() {
	}

	@Override
	public ProductBean addProduct(ApplyProductBean applyProductBean) {
		ProductBean productBean = new ProductBean();
		String productId = doAddProduct(applyProductBean);
		productBean.setProductId(productId);
		productBean.setProductLivesBean(live.addProductInLives(productId));
		productBean.setProductActivitysBean(activity
				.addProductInActivitys(productId));
		return productBean;
	}

	protected abstract String doAddProduct(ApplyProductBean applyProductBean);

}
